Forum Replies Created

Viewing 15 posts - 121 through 135 (of 159 total)

  • RE: Joining on datetimes but ignoring the time part

    not sure this will be better than convert(), but can give it a try

    select dateadd(day, 0, datediff(day, 0, getdate()))

  • RE: Set-based query

    >> Or use the number table function to populate the Numbers table (I that's what you meant, KH, I apologize...)

    You are right. Using a number table is definately faster than...

  • RE: Set-based query

    >> SELECT INTO is turned off.

    Get the DBA to pre-create the fixed number table with the required number of records. If it is not possible, try the number table function...

  • RE: Set-based query

    Records in Number Table required pre-insert however Number Table Function is dynamic. Altough you can pre-insert up to the maximum of the data type used (int or bigint) but anyway...

  • RE: Table names involved in a CONSTRAINT

    select object_name(fkeyid) as parent_table, object_name(rkeyid) as fkey_table

    from sysreferences

    where constid = (select id from sysobjects where name = 'foreign_key_name')

  • RE: Set-based query

    Depending on the maximum possible value of MaxPeriod. If it is relatively small like < 10 then there is no harm using a derived table with union all. If the...

  • RE: Set-based query

    Try this :

    select n.num, m.rfreq, m.pfreq

    from tblmain m inner join MaxPeriods p

    onm.rfreq= p.rfreq

    cross join

    (

    select1 as num union all select 2 union all select 3 union all

    select 4 union...

  • RE: Creating and filling SDF files...

    No. But you can use replication or RDA to download the tables & data. You still need to code the replication & RDA command in your application.

  • RE: tempTable w/ identity column

    >> alter this tempTable and add an identity column.

    >> sqlserver says that id is an invalid column name.

    what is the column name for the identity column ? Looks like...

  • RE: Re-Installation SQL on a Laptop

    to un-install SQL Server, go to Control Panel and uninstall it. If for whatever reason it fails, you can manully uninstall it with reference to this http://support.microsoft.com/kb/290991/

  • RE: SP - CSV String as input parameter

    declare @sListvarchar(100), @sqlcmd nvarchar(1000)

    select @sList = 'v1,v2,v3'

    select @sqlcmd = 'select * from table where fld in ' + replace('(''' + @sList + ''')', ',', ''',''')

    exec (@sqlcmd)

  • RE: Knotting records on enddate = firstdate

    Try this :

    select d1.DateFrom as Date_From, d2.DateTo as Date_To

    from#dates d1 inner join #dates d2

    on d1.DateTo = d2.DateFrom

    union all

    select d.DateFrom, d.DateTo

    from#dates d

    wherenot exists (select *

    from#dates d_1 inner join #dates d_2

    on d_1.DateTo...

  • RE: Searching for all the words

    select * from Products p

    inner join OtherInfo o

    on p.ProductID = o.ProductID

    where p.productid like '%' + @your_keyword + '%'

    or o.manufacturer like '%' + @your_keyword + '%'

  • RE: A join query

    assumption : time in and time out are of same day

    select emp_name, convert(char(7), work_date, 121) as work_month, sum(work_hour) as total_work_hour

    from

    (

    selects.emp_name, convert(datetime, convert(char(8), s.log_time, 112)) as work_date, min(s.log_time) as start_time, max(e.log_time)...

  • RE: case ...when

    try this :

    change your case statement to

    and v.agentCode like substring(@agentcode, 1, 2) + '%'

Viewing 15 posts - 121 through 135 (of 159 total)